<?php
require GROO_TEMPLATES . '/list/header.inc';

if (count($items)) {
    $cManager = &new Prefs_CategoryManager();
    $colors = $cManager->colors();
    $fgcolors = $cManager->fgColors();
    $sortby = $prefs->getValue('sortby');
    $sortdir = $prefs->getValue('sortdir');
    require GROO_TEMPLATES . '/list/item_headers.inc';

    foreach ($items as $item_id => $item) {
        $color = isset($colors[$item['category']]) ? $colors[$item['category']] : $colors['_default_'];
        $fgcolor = isset($fgcolors[$item['category']]) ? $fgcolors[$item['category']] : $fgcolors['_default_'];

        $viewurl = Util::addParameter('view.php', array('item' => $item['item_id'],
                                                        'itemlist' => $item['itemlist_id']));

        $itemurl = Util::addParameter('item.php', array('item' => $item['item_id'],
                                                        'itemlist' => $item['itemlist_id']));
        $book = $item['book'];
        $imgPath = 'images/medium/'.$book->getISBN13().'.jpg';
            if (file_exists(GROO_BASE.'/'.$imgPath)) {
                $imgTitle = $book->getTitle();
                $imgHeight = 75;
            } else {
                $imgPath = 'themes/graphics/network-active.gif';
                $imgTitle = 'Retrieving book data...';
                $imgHeight = 15;
            }

        $share = $GLOBALS['groo_shares']->getShare($item['itemlist_id']);

        require GROO_TEMPLATES . '/list/item_summaries.inc';
    }

    require GROO_TEMPLATES . '/list/item_footers.inc';
} else {
    require GROO_TEMPLATES . '/list/empty.inc';
}
?>

